﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EzDesk.Project.Service.Repositories.Interfaces;
using EzDesk.Project.Model;

namespace EzDesk.Project.Service.Repositories.Mock
{
    public class Mock_PlaneTaskRepository : Mock_Repository<PlaneTask>, IPlaneTaskRepository
    {
        public Guid TestProjectId1 = new Guid("80CB7E0F-1B4E-428C-92D9-DED7D943AFE8");
        public Guid TestProjectId2 = new Guid("8B544374-105E-454D-900A-E389A9DA37EB");

        public Guid TestPlaneId2_1 = new Guid("15B1D5BD-6C37-4D12-98E9-8C3BBFBFEEF9");
        public Guid TestPlaneId2_2 = new Guid("0516E47F-F36E-4AC2-A3B7-4FDA05EC53FF");
        public Guid TestPlaneId3_1 = new Guid("5F59996D-333C-468F-9739-B97778C84600");

        public Mock_PlaneTaskRepository()
        {
            if (!HasInitialized)
            {
                innerManager.ClearAll();

                innerManager.Add(new PlaneTask()
                {
                    Id = TestPlaneId2_1,
                    ProjectId = TestProjectId2,
                    PlaneType = PlaneTypeEnum.概念,
                    StartOn = DateTime.Parse("2010/5/3"),
                    EndOn = DateTime.Parse("2010/5/14"),
                    IsClosed = false,
                    Director = innerManager.ApiClient.GetSimpleUserById(innerManager.SampleUsers["龚伟"]),                    
                }, true);

                innerManager.Add(new PlaneTask()
                {
                    Id = TestPlaneId2_2,
                    ProjectId = TestProjectId2,
                    PlaneType = PlaneTypeEnum.扩初,
                    StartOn = DateTime.Parse("2010/5/15"),
                    EndOn = DateTime.Parse("2010/5/20"),
                    IsClosed = false,
                    Director = innerManager.ApiClient.GetSimpleUserById(innerManager.SampleUsers["杨裕欣"]),
                }, true);
            }
            base.Initialize();
        }

        public IList<PlaneTask> GetPlanesFromProject(Guid projectId)
        {
            return GetAll().Where(p => p.ProjectId == projectId).ToList();
        }
    }
}
